package priv.mill.base;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.log4j.Logger;

public class MyTypeHandler extends BaseTypeHandler<String> {

	private static final Logger logger = Logger.getLogger(MyTypeHandler.class);

	@Override
	public void setNonNullParameter(PreparedStatement ps,
			int i, String parameter, JdbcType paramJdbcType)
			throws SQLException {
		
		ps.setString(i, parameter);
	}

	@Override
	public String getNullableResult(ResultSet rs, String columnName)
			throws SQLException {
		return "haha";//rs.getString(columnName);
	}

	@Override
	public String getNullableResult(ResultSet rs, int columnIndex)
			throws SQLException {
		return "hehe";//rs.getString(columnIndex);
	}

	@Override
	public String getNullableResult(CallableStatement rs,
			int columnIndex) throws SQLException {
		return rs.getString(columnIndex);
	}
}
